// import com.alibaba.druid.DbType;
// import com.alibaba.druid.sql.ast.SQLCommentHint;
// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLObject;
// import com.alibaba.druid.sql.ast.SQLStatementImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.Collections;
// import java.util.List;

#include "SQLStartTransactionStatement.h"
#include "../../visitor/SQLASTVisitor.h"

SQLStartTransactionStatement_IsolationLevel_ptr SQLStartTransactionStatement_IsolationLevel::SERIALIZABLE = SQLStartTransactionStatement_IsolationLevel_ptr(new SQLStartTransactionStatement_IsolationLevel(make_string_ptr("SERIALIZABLE")));
SQLStartTransactionStatement_IsolationLevel_ptr SQLStartTransactionStatement_IsolationLevel::REPEATABLE_READ = SQLStartTransactionStatement_IsolationLevel_ptr(new SQLStartTransactionStatement_IsolationLevel(make_string_ptr("REPEATABLE READ")));
SQLStartTransactionStatement_IsolationLevel_ptr SQLStartTransactionStatement_IsolationLevel::READ_COMMITTED = SQLStartTransactionStatement_IsolationLevel_ptr(new SQLStartTransactionStatement_IsolationLevel(make_string_ptr("READ COMMITTED")));
SQLStartTransactionStatement_IsolationLevel_ptr SQLStartTransactionStatement_IsolationLevel::READ_UNCOMMITTED = SQLStartTransactionStatement_IsolationLevel_ptr(new SQLStartTransactionStatement_IsolationLevel(make_string_ptr("READ UNCOMMITTED")));

SQLStartTransactionStatement_IsolationLevel::SQLStartTransactionStatement_IsolationLevel(string_ptr text)
{
  this->text = text;
}

string_ptr SQLStartTransactionStatement_IsolationLevel::getText()
{
  return text;
}

SQLStartTransactionStatement::SQLStartTransactionStatement()
{
  hints = std::make_shared<std::list<SQLCommentHint_ptr>>();
}

SQLStartTransactionStatement::SQLStartTransactionStatement(DbType_ptr dbType)
{
  this->dbType = dbType;
  hints = std::make_shared<std::list<SQLCommentHint_ptr>>();
}

BOOL_ptr SQLStartTransactionStatement::isConsistentSnapshot()
{
  return consistentSnapshot;
}

void SQLStartTransactionStatement::setConsistentSnapshot(BOOL_ptr consistentSnapshot)
{
  this->consistentSnapshot = consistentSnapshot;
}

BOOL_ptr SQLStartTransactionStatement::isBegin()
{
  return begin;
}

void SQLStartTransactionStatement::setBegin(BOOL_ptr begin)
{
  this->begin = begin;
}

BOOL_ptr SQLStartTransactionStatement::isWork()
{
  return work;
}

void SQLStartTransactionStatement::setWork(BOOL_ptr work)
{
  this->work = work;
}

SQLStartTransactionStatement_IsolationLevel_ptr SQLStartTransactionStatement::getIsolationLevel()
{
  return isolationLevel;
}

void SQLStartTransactionStatement::setIsolationLevel(SQLStartTransactionStatement_IsolationLevel_ptr isolationLevel)
{
  this->isolationLevel = isolationLevel;
}

void SQLStartTransactionStatement::accept0(SQLASTVisitor_ptr visitor)
{
  visitor->visit(SharedObject(SQLStartTransactionStatement));

  visitor->endVisit(SharedObject(SQLStartTransactionStatement));
}

SQLCommentHint_list_ptr SQLStartTransactionStatement::getHints()
{
  return hints;
}

void SQLStartTransactionStatement::setHints(SQLCommentHint_list_ptr hints)
{
  this->hints = hints;
}

SQLExpr_ptr SQLStartTransactionStatement::getName()
{
  return name;
}

void SQLStartTransactionStatement::setName(SQLExpr_ptr name)
{
  if (name != nullptr)
  {
    name->setParent(SharedObject(SQLStartTransactionStatement));
  }
  this->name = name;
}

// @Override
SQLObject_list_ptr SQLStartTransactionStatement::getChildren()
{
  SQLObject_list_ptr tmp = std::make_shared<std::list<SQLObject_ptr>>();
  if (name != nullptr)
  {
    tmp->push_back(name);
  }
  return tmp;
}

BOOL_ptr SQLStartTransactionStatement::isReadOnly()
{
  return readOnly;
}

void SQLStartTransactionStatement::setReadOnly(BOOL_ptr readOnly)
{
  this->readOnly = readOnly;
}
